//
//  SAPSellCarTableViewCell.m
//  CarsHome
//
//  Created by dapeng on 15/12/5.
//  Copyright © 2015年 dapeng. All rights reserved.
//

#import "SAPSellCarTableViewCell.h"
#import "Theme-PrefixHeader.pch"
@implementation SAPSellCarTableViewCell
- (void)dealloc {
    [_carsName release];
    [_prices release];
    [_imageview release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageview = [[UIImageView alloc] init];
        self.carsName = [[UILabel alloc] init];
        self.prices = [[UILabel alloc] init];
        [_prices release];
        [_imageview release];
        [_carsName release];
        [self addSubview:self.imageview];
        [self addSubview:self.carsName];
        [self addSubview:self.prices];
        [_imageview release];
        [_carsName release];
        [_prices release];
        self.backgroundColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"ygColor"];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor) name:ThemeChangeNotification object:nil];
        [self changeColor];
    }return self;
}
- (void)changeColor {
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *passWord = [ user objectForKey:@"userPassWord"];
    if (!(passWord == nil) && [passWord isEqualToString:@"123456"]) {
        self.backgroundColor = [UIColor whiteColor];
    }else {
        
        self.backgroundColor = [UIColor colorWithWhite:0.126 alpha:1.000];
        self.carsName.textColor = RGB(153.0,153.0,153.0,1.0f);
        self.prices.textColor = RGB(153.0,153.0,153.0,1.0f);


    }
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.imageview.frame = CGRectMake(10, 10, 90, 60);
    self.carsName.frame = CGRectMake(110, 10, 200, 30);
    self.prices.frame = CGRectMake(110, 50, 200, 20);
}
- (void)setThreeModel:(SAPFindCarThreeModel *)threeModel {
    if (_threeModel != threeModel) {
        [_threeModel release];
        _threeModel = [threeModel retain];
    }
    [self.imageview sd_setImageWithURL:[NSURL URLWithString:threeModel.imgurl]];
    self.carsName.text = threeModel.name;
    self.prices.text = threeModel.prices;
    _prices.font = [UIFont systemFontOfSize:12];
    _prices.textColor = [UIColor redColor];
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
